home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_teTeX.idb / usr / freeware / share / texmf / dvips / pstricks / pst-ghsb.pro.z / pst-ghsb.pro
Text File  |  2001-01-10  |  3KB  |  91 lines

  1. %!
  2. %                           -*- Mode: Postscript -*- 
  3. % pst-ghsb.pro --- PostScript header file pst-ghsb.pro
  4. %                  For the PSTricks HSB mode gradient fillstyle
  5. %                  Based on pst-grad.pro from Timothy van Zandt
  6. %                  Syntax:
  7. %                    H0 S0 B0 H1 S1 B1 MidPoint NumLines Angle GradientFillHSB
  8. % Author          : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
  9. % Created the     : Tue May 13 11:12:36 1997
  10. % Version         : 1.0
  11. % Last mod. by    : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
  12. % Last mod. the   : Wed May 14 18:48:03 1997
  13.  
  14. % Syntax:
  15. %   H0 S0 B0 H1 S1 B1 NumLines MidPoint Angle GradientFillHSB
  16.  
  17. /tx@GradientHSBDict 40 dict def
  18. tx@GradientHSBDict begin
  19. /GradientFillHSB {
  20.   rotate
  21.   /MidPoint ED
  22.   /NumLines ED
  23.   /LastBrightness ED
  24.   /LastSaturation ED
  25.   /LastHue ED
  26.   /FirstBrightness ED
  27.   /FirstSaturation ED
  28.   /FirstHue ED
  29.   % This avoids gaps due to rounding errors:
  30.   clip
  31.   pathbbox           %leave llx,lly,urx,ury on stack
  32.   /y ED /x ED
  33.   2 copy translate
  34.   y sub neg /y ED
  35.   x sub neg /x ED
  36.   % This avoids gaps due to rounding errors:
  37.   LastHue FirstHue add 2 div
  38.   LastSaturation FirstSaturation add 2 div
  39.   LastBrightness FirstBrightness add 2 div
  40.   sethsbcolor
  41.   fill
  42.   /YSizePerLine y NumLines div def
  43.   /CurrentY 0 def
  44.   /MidLine NumLines 1 MidPoint sub mul abs cvi def
  45.   MidLine NumLines 2 sub gt
  46.   { /MidLine NumLines def }
  47.   { MidLine 2 lt { /MidLine 0 def } if }
  48.   ifelse
  49.   MidLine 0 gt
  50.   {
  51.     /Hue FirstHue def
  52.     /Saturation FirstSaturation def
  53.     /Brightness FirstBrightness def
  54.     /HueIncrement LastHue FirstHue sub MidLine 1 sub div def
  55.     /SaturationIncrement LastSaturation FirstSaturation sub MidLine 1 sub
  56.                          div def
  57.     /BrightnessIncrement LastBrightness FirstBrightness sub MidLine 1 sub
  58.                          div def
  59.     MidLine { GradientLoopHSB } repeat
  60.   } if
  61.   MidLine NumLines lt
  62.   {
  63.     /Hue LastHue def
  64.     /Saturation LastSaturation def
  65.     /Brightness LastBrightness def
  66.     /HueIncrement FirstHue LastHue sub NumLines MidLine sub 1 sub div def
  67.     /SaturationIncrement FirstSaturation LastSaturation sub
  68.                          NumLines MidLine sub 1 sub div def
  69.     /BrightnessIncrement FirstBrightness LastBrightness sub
  70.                          NumLines MidLine sub 1 sub div def
  71.     NumLines MidLine sub { GradientLoopHSB } repeat
  72.   } if
  73. } def
  74. /GradientLoopHSB {
  75.   0 CurrentY moveto
  76.   x 0 rlineto
  77.   0 YSizePerLine rlineto
  78.   x neg 0 rlineto
  79.   closepath
  80.   Hue Saturation Brightness sethsbcolor fill
  81.   /CurrentY CurrentY YSizePerLine add def
  82.   /Brightness Brightness BrightnessIncrement add def
  83.   /Saturation Saturation SaturationIncrement add def
  84.   /Hue Hue HueIncrement add def
  85. } def
  86.  
  87. end
  88. % END pst-ghsb.pro
  89.